package com.kundi.dooradmin.mapper;

import com.kundi.dooradmin.entity.CompanyDynamic;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;


/**
 * Author 赵恒
 * Date 2020/6/17
 */
public interface CompanyDynamicMapper extends Mapper<CompanyDynamic> {

    @Select("select id, title, content, create_date as createDate from tb_company_dynamic ORDER BY create_date desc")
    List<CompanyDynamic> getAll();


    @Select("select id, title, content, create_date as createDate from tb_company_dynamic where id = #{id}")
    String getContentById(@Param("id") Integer id);

    @Select("select id, title, content, create_date as createDate from tb_company_dynamic where id = #{id}")
    CompanyDynamic getDynamicById(@Param("id") Integer id);

    @Delete("delete from tb_company_dynamic where id = #{id}")
    Integer deleteById(@Param("id") Integer id);

    @Select("select id, title, create_date as createDate from tb_company_dynamic order by create_date desc limit 0, 7")
    List<CompanyDynamic> getRecentDynamic();
}
